﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Controller;
using Interface;

namespace Projekt3.UC
{
    /// <summary>
    /// Interaction logic for Product.xaml
    /// </summary>
    public partial class Product : UserControl
    {
        MyController myController;
        public Product(MyController controller, /*int id*/ IProduct product)
        {
            InitializeComponent();
            myController = controller;
            /*
            List<IProduct> products = myController.GetProducts();
            IProduct product = myController.FindProduct(id);
            IProductDetail productDetail = myController.FindProductDetail(id);*/
            lblName.Content = product.Id;
            lblPrice.Content = product.Price + " kr";

            this.Loaded += new RoutedEventHandler(UserControl_Loaded);
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            ////http://stackoverflow.com/questions/6682274/change-wpf-windows-label-content-from-child-user-control

            //var main = Window.GetWindow(this) as MainWindow;
            //if (main != null)
            //{
            //    main.btnNext.IsEnabled = false;
            //    main.cbGo2Page.Items.Clear();
            //    main.cbGo2Page.Items.Add(1);
            //    main.cbGo2Page.SelectedIndex = 0;
            //}
        }

    }
}
